home *** CD-ROM | disk | FTP | other *** search
- From: thp@cs.ucr.edu (Tom Payne)
- Message-ID: <4fu1kp$ifs@galaxy.ucr.edu>
- X-Original-Date: 15 Feb 1996 01:18:17 GMT
- Path: in1.uu.net!bounce-back
- Date: 15 Feb 96 12:04:30 GMT
- Approved: fjh@cs.mu.oz.au
- Return-Path: <daemon@meeker.UCAR.EDU>
- Newsgroups: comp.std.c++
- Subject: Re: Throwing an exception from within a signal handler
- Organization: University of California, Riverside Department of Computer Science
- References: <4f2th6$4qh@galaxy.ucr.edu> <DMH620.FKn@falcon.daytonoh.attgis.com>
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMSMhWeEDnX0m9pzZAQF+KQF/bec8gv9SND/j44gJ0bgEB0mt0prkZUSK
- +y0GKcXZenhBdkewJ1F3BsleOlMwffVe
- =haKb
-
- Dick Menninger (Dick.Menninger@daytonoh.attgis.com) wrote:
- : > ==========Tom Payne, 2/4/96==========
- : > In the case of nonatomic
- : > variables, atomicity must be enforced by blocking certain signals.
- : > Such blockage could be portably implemented via atomic blockage flags,
- : > which, in turn, are volatile atomic variables that must be read by
- : > signal handers.
- :
- : Although that could keep them from reading a bad value,
- : they have no way to wait for it to become valid if they
- : interrupted the owner. So, the updater thread would have
- : to fully block the signals that really need the value in the
- : handler for handling to proceed. That is, the problems
- : are more severe than between threads that do not interrupt
- : each other (a signal handler is just a specialized thread,
- : whether or not the environment's terminology calls it that
- : is irrelevant).
-
- The issues are the same as in any concurrent programming:
-
- You've got protect critical data with locks, and you must block
- an interrupt (signal) whenever you hold a lock that its handler
- might attempt to acquire.
-
- The locks and blockage mechanisms must be atomic, but not the data
- they protect (which de-facto is subject to atomic access only).
-
- Atomicity issues aside, the multithreaded context is probably the
- correct one in which to consider the semantics for exceptions thrown
- by signal handlers. For instance, which thread should catch such an
- exception? The interrupted thread is sort of a hapless victim, and
- there's no reason to expect it to be prepared to handle the exception.
- If we let the throwing handler designate the catcher, we have a form
- of pre-emptive message passing, where the message-receiver function
- rethrows the exception in the context of the cathcher thread. This
- may make some of the problems easier, if the invocation of the
- receiver can be made to occurr at conventient times, e.g., when the
- stack is tidy.
-
- Tom Payne
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. Moderation policy:
- http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
-